package chaojishuzu;

import java.util.Objects;

/**
 * 学生类
 */
public class Student {
    private String name;
    private int age;
    private String gender;
    public Student() {
    }

    public Student(String name,String gender,int age) {
        this.name = name;
        this.gender = gender;
        this.age = age;
    }

    public Student(String name) {
        this.name = name;
    }
//重写equals和hashCode的方法
    @Override
    public boolean equals(Object object) {
        Student student = (Student) object;
        if (this.name.equals(student.getName())){
            return true;
        }
        return false;
    }

    @Override
    public int hashCode() {
        return Objects.hash(name);
    }
//重写ToString方法
    @Override
    public String toString() {
        return  name + ", " + age + "," + gender;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getGender() {
        return gender;
    }

    public void setGender(String gender) {
        this.gender = gender;
    }
}
